module.exports = app => {
    const { mongoose } = app;
    const { Schema } = mongoose;
    const Person = new Schema({
        nickName: {
            type: String,
            require: true,
        },
        id: {
            type: String,
            require: true
        },
        sex: {
            type: Number,
            require: true
        }
    })
    const Tag = new Schema({
        tag: {
            type: String
        },
        color: {
            type: String
        }
    })
    const OrderSchema = new Schema({
        create_time: {
            type: Date,
            require: true,
            default: Date.now()
        },
        name: {
            type: String,
            require: true,
            default: ""
        },
        start_time: {
            type: Date,
            require: true
        },
        longitude: {
            type: Number,
            require: true
        },
        latitude: {
            type: Number,
            require: true
        },
        is_sex: {
            type: Number,
            require: true,
            default: false
        },
        male_num: {
            type: Number,
            require: true,
            default: false
        },
        female_num: {
            type: Number,
            require: true,
            default: false
        },
        price: {
            type: Number,
            require: true,
            default: 100
        },
        create_by_id: {
            type: String,
            require: true
        },
        persons: {
            type: [Person],
            default: []
        },
        tags: {
            type: [Tag],
            default: []
        },
        status:{
            type:Number,
            require:true,
            default:0,
            //0 未拼成
            //1 已拼成
            //2 已过期
            //3 已完成
        }


    })
    return mongoose.model("Order", OrderSchema)
}